Skip to content

Conversation

nikgraf
Copy link
Collaborator

@nikgraf nikgraf commented Sep 18, 2025

No description provided.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds Privy authentication-based space creation functionality to the hypergraph-react package. It introduces two new hooks that allow users to create private and public spaces using Privy authentication instead of the existing createSpace method.

  • Adds usePrivyAuthCreatePrivateSpace and usePrivyAuthCreatePublicSpace hooks with comprehensive authentication and encryption handling
  • Updates the example app to use the new hooks with a space type selector UI
  • Modifies the context to expose syncServerUri for private space creation

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/hypergraph-react/src/index.ts Exports the new Privy auth hooks with underscore prefixes
packages/hypergraph-react/src/hooks/use-spaces.ts Updates query key for public spaces to avoid conflicts
packages/hypergraph-react/src/hooks/use-privy-auth-create-public-space.ts Implements public space creation with Privy auth
packages/hypergraph-react/src/hooks/use-privy-auth-create-private-space.ts Implements private space creation with encryption and Privy auth
packages/hypergraph-react/src/HypergraphAppContext.tsx Adds syncServerUri to context for private space creation
apps/privy-login-example/src/routes/index.tsx Integrates new hooks with UI for space creation
.changeset/plain-eggs-joke.md Documents the patch-level change

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

const createPrivateSpace = async ({ name }: CreatePrivateSpaceParams) => {
const accountAddress = privyIdentity?.accountAddress;
if (!accountAddress) {
setIsLoading(false);
Copy link

Copilot AI Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting isLoading to false before throwing an error is incorrect. The loading state should remain true since the operation hasn't completed yet, and the error will be thrown to the caller.

Copilot uses AI. Check for mistakes.

const signaturePrivateKey = privyIdentity?.signaturePrivateKey;
const signaturePublicKey = privyIdentity?.signaturePublicKey;
if (!encryptionPrivateKey || !encryptionPublicKey || !signaturePrivateKey || !signaturePublicKey) {
setIsLoading(false);
Copy link

Copilot AI Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting isLoading to false before throwing an error is incorrect. The loading state should remain true since the operation hasn't completed yet, and the error will be thrown to the caller.

Copilot uses AI. Check for mistakes.

}
const privyIdentityToken = privyIdentity?.privyIdentityToken;
if (!privyIdentityToken) {
setIsLoading(false);
Copy link

Copilot AI Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting isLoading to false before throwing an error is incorrect. The loading state should remain true since the operation hasn't completed yet, and the error will be thrown to the caller.

Copilot uses AI. Check for mistakes.

const [spaceName, setSpaceName] = useState('');
const { createPrivateSpace, isLoading: isCreatingPrivateSpace } = usePrivyAuthCreatePrivateSpace();
const { createPublicSpace, isLoading: isCreatingPublicSpace } = usePrivyAuthCreatePublicSpace();
console.log({ isCreatingPrivateSpace, isCreatingPublicSpace });
Copy link

Copilot AI Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug console.log statement should be removed before merging to production.

Suggested change
console.log({ isCreatingPrivateSpace, isCreatingPublicSpace });

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant